package cn.hdu.liang.observer.weather;

public class CurrentConditionDisplay implements Observer, DisplayElement {
    private double temp;
    private double humidity;
    private Subject weatherData;

    public CurrentConditionDisplay(Subject weatherData) {
        this.weatherData = weatherData;
        weatherData.registerObserver(this);
    }

    public void update(double temp, double humidity, double pressure) {
        this.temp = temp;
        this.humidity = humidity;
        display();
    }

    public void display() {
        System.out.println("当前状态： " + temp + "华氏度 " + humidity + "% 湿度");
    }
}
